import java.util.Random;

public class Demo3 {
    public static int num1 = 0;
    public static int num2 = 0;

    public Integer[] arr = new Integer[1000];
    public static void main(String[] args) throws InterruptedException {
        Random random = new Random(100);
        Thread t1 = new Thread(() -> {
            for (int i = 0; i < 1001; i = i + 2) {
                num1 = num1 + i;
            }
        });

        Thread t2 = new Thread(() -> {
            for (int i = 1; i < 1000; i=i+2) {
                num2 = num2 + i;
            }
        });

        t1.start();
        t2.start();
        t1.join();
        t2.join();

        System.out.println(num1+num2);
    }
}
